package org.NooLab.glue.storage;

import java.io.Serializable;

import org.NooLab.glue.MessageBoard;
import org.NooLab.glue.components.MessageBoardShare;
import org.NooLab.glue.components.MessageBoardShareIntf;


/**
 * 
 * 
 * for persistence, including buffered data from senders and all states
 *
 *
 *
 */
class MsgBoardInternalData implements Serializable{

	transient private static final long serialVersionUID = 1052430783290900486L;

	transient MessageBoardShareIntf msgBoard;
	
	long globalReceiptID ;
	long globalRegisteredID ;
	// int msgPortforSenders ;
	// int msgPortforClients ;
	
	
	public MsgBoardInternalData(   ){
		 		
	}
	
	public void setMsgBoardInternalData( MessageBoardShareIntf msgboard ){
		msgBoard = msgboard;		
	}
	
	public void deliverData(){
		globalReceiptID = msgBoard.getGlobalReceipts().getGlobalReceiptID() ;
		/*
		msgPortforSenders = msgBoard.getMsgPortforSources() ;
		msgPortforClients = msgBoard.getMsgPortforReceptors() ;
		*/
		
		globalRegisteredID = msgBoard.getGlobalReceipts().getGlobalRegisteredID() ;
	}
	
	
	
	public void retrieveData(){
		
		if ( msgBoard.getGlobalReceipts().getGlobalReceiptID()< globalReceiptID ){
			 msgBoard.getGlobalReceipts().setGlobalReceiptID( globalReceiptID ) ;
		}
		
		/*
		if (msgPortforSenders>450){
			msgBoard.setMsgPortforSources( msgPortforSenders ) ;
		}
		if (msgPortforClients>450 ){
			msgBoard.setMsgPortforReceptors( msgPortforClients ) ;
		}
		*/
		
		if (msgBoard.getGlobalReceipts().getGlobalRegisteredID()<globalRegisteredID){
			msgBoard.getGlobalReceipts().setGlobalRegisteredID(globalRegisteredID) ;
		}
		
		
	}


	public long getGlobalReceiptID() {
		return globalReceiptID;
	}


	public void setGlobalReceiptID(long globalReceiptID) {
		this.globalReceiptID = globalReceiptID;
	}


	public long getGlobalRegisteredID() {
		return globalRegisteredID;
	}


	public void setGlobalRegisteredID(long globalRegisteredID) {
		this.globalRegisteredID = globalRegisteredID;
	}

	/*
	public int getMsgPortforSenders() {
		return msgPortforSenders;
	}


	public void setMsgPortforSenders(int msgPortforSenders) {
		this.msgPortforSenders = msgPortforSenders;
	}


	public int getMsgPortforClients() {
		return msgPortforClients;
	}


	public void setMsgPortforClients(int msgPortforClients) {
		this.msgPortforClients = msgPortforClients;
	}
	 */
	
}
